package com.proxy.cglib;

/**
 * @author zhupanlin
 * @version 1.0
 * @description: TODO
 * @date 2024/4/16 15:09
 */
public class Client {

    public static void main(String[] args) {
        // 创建目标对象
        TeacherDao teacherDao = new TeacherDao();
        // 获取到代理对象，并将目标对象传递给代理对象
        TeacherDao proxyInstance = (TeacherDao) new ProxyFactory(teacherDao).getProxyInstance();
        
        // 执行代理对象的方法, 触发interceptor方法，从而实现对目标对象的增强
        String result = proxyInstance.teach();
        System.out.println("result = " + result);
    }
    
}
